<?php
/* * * * *
 * File: logout.php
 * Author: freighter9@gmail.com
 * Version: 0.5 (beta testing)
 *
 * * * * * *
 * License:
 * This file is part of the PLogin project hosted at
 * http://code.google.com/p/plogin.  All files of the PLogin
 * project are licensed under the GNU General Public License 2.0.
 *
 * * * * *
 * Usage:
 * This script handles user account logouts.  It simply destroys
 * the user's session data and returns to normal.
 *
 * * * * *
 */
 
// Check to see if user is logged in.
session_start();
if ($_SESSION['loggedIn'] != 1) {
	echo 'Error: You cannot logout because you are not <a href="login_form.html">logged in</a>.';
	exit();
}
	
// Logout:
$_SESSION['loggedIn'] = 0;
$_SESSION['user'] = null;
session_destroy();

echo 'You have been logged out of the system.<br>';
echo 'Go back to <a href="login_form.html">login page</a>.';
?>

